package com.li.test.model5;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Model5Controller {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @GetMapping("/topic")
    public ResponseEntity topic(String msg,String key) {
        rabbitTemplate.convertAndSend("topic.exchange",key,msg);
        return ResponseEntity.ok("消息发送成功！");
    }
}
